package com.card.game.log;

import com.card.game.room.BetRegion;
import com.card.user.User;
import com.card.user.UserUtils;

/**   
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author siyunlong  
 * @date 2016年8月31日 下午4:38:43 
 * @version V1.0   
 */
public class TggResult implements Comparable<TggResult>{
	public String userId;
	private String nickName="未知";
	public int xiazu;
	public int win;
	public int lost;
	public int score;
	
	public TggResult(String userId) {
		super();
		this.userId = userId;
		User user = UserUtils.getUserByPrimaryKey(userId);
		if(user != null) {
			this.nickName = user.userExtra().getNickName();
		}
	}
	
	public void cal(BetRegion region,int calScore) {
		if(region.getTotal()>0) {
			this.xiazu ++;
			if(calScore>0) {
				this.win++;
			}else{
				this.lost++;
			}
			this.score += calScore;
		}
	}
	public void calZhuang(int calScore) {
		this.score += calScore;
	}

	public int getScore() {
		return score;
	}

	@Override
	public int compareTo(TggResult o) {
		return o.score - this.score;
	}
	
}
